﻿using AngularTest2.Models;
using AngularTest2.ViewModel;
using Newtonsoft.Json;
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace AngularTest2.Controllers
{
    public class EventController : Controller
    {
        // GET: Event
        public ActionResult Index()
        {
            EventModel events = new EventModel();
            events.Talks = GetTalks();
            return View("Index", events);
        }

        private string GetTalks()
        {
            var talks = new[]
            {
                new TalkVM {Id=10, Name = "Eliel", Speaker="eliel" }
            };

            var setting = new JsonSerializerSettings { ContractResolver = new CamelCasePropertyNamesContractResolver() };
            return JsonConvert.SerializeObject(talks, Formatting.None, setting);
        }
    }
}